<extend name="Public/base"/>
<block name="body">
  <div class="fixed-bar" id="Addons_Bar">
    <div class="item-title">
      <h3>插件</h3>
      <ul class="tab-base">
        <li><a class="current" href="JavaScript:void(0);" onclick="Data_Reload('Addons_Data_List');"><span>列表</span></a></li>
      </ul>
    </div>
  </div>
  <table id="Addons_Data_List">
  </table>
  <script type="text/javascript">
$(function() {
	$("#Addons_Data_List").datagrid({
		url : "{:U('Addons/index')}",
		fit : true,
		striped : true,
		border : false,
		toolbar : '#Addons_Bar',
		singleSelect : true,
		columns : [[
			{field : "name",title : "插件名",width :100},
			{field : "title",title : "中文名",width :100},
			{field : "description",title : "插件描述",width :200},
			{field : "status",title : "状态",width :60,formatter: function (value, row, index) {
				if(value!=null){
					var op_status=new Array()
					op_status["-1"]="禁用"
					op_status["0"]="禁用"
					op_status["1"]="启用"
					return op_status[value];
				}else{
					return '未安装';
				}
			}},
			{field : "author",title : "作者",width :100},
			{field : "version",title : "版本号",width :100},
			{field : "create_time",title : "安装时间",width :130,formatter: function (value, row, index) {
				if(value!=null){
					return u_to_ymdhis(value)
				}else{
					return '未安装';
				}
				
			}},
			{field : "operate",title : "操作",width : 200,formatter: function (value, row, index) {
				operate_menu='';
				<if condition="Is_Auth('Admin/Addons/config')">
				if(row.has_adminlist==1){
					operate_menu = operate_menu+"<a href='<?php echo U('config'); ?>&id="+row.id+"' >配置</a> | ";
				}
				</if>
				<if condition="Is_Auth('Admin/Addons/install')">
					if(row.uninstall == 1){
						operate_menu = operate_menu+"<a href='<?php echo U('install'); ?>&addon_name="+row.name+"' >安装</a>";
					}
				</if>
				<if condition="Is_Auth('Admin/Addons/uninstall')">
					if(row.uninstall != 1){
						operate_menu = operate_menu+"<a href='<?php echo U('uninstall'); ?>&id="+row.id+"' >卸载</a>";
					}
				</if>
				<if condition="Is_Auth('Admin/Addons/status')">
					if(row.status==1){
						operate_menu = operate_menu+" | <a href='<?php echo U('status',array('status'=>0)); ?>&id="+row.id+"' >禁用</a>";
					}
					if(row.status==0){
						operate_menu = operate_menu+" | <a href='<?php echo U('status',array('status'=>1)); ?>&id="+row.id+"' >启用</a>";
					}
				</if>
				return operate_menu;
			}}
		]]
	});
})
</script></block>
